﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="InputAchievementPage.aspx.cs" Inherits="FBKPI.Pages.InputAchievementPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="<%= ResolveUrl("~/scripts/plupload/moxie.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/plupload/plupload.full.min.js") %>" type="text/javascript"></script>
    <link href="<%= ResolveUrl("~/styles/jquery.fileupload-ui.css") %>" rel="stylesheet"
        type="text/css" />
    <link href="<%= ResolveUrl("~/styles/jquery.fileupload-noscript.css") %>" rel="stylesheet"
        type="text/css" />
    <link href="<%= ResolveUrl("~/styles/jquery.fileupload-ui-noscript.css") %>" rel="stylesheet"
        type="text/css" />
    <link href="<%= ResolveUrl("~/styles/jquery.fileupload.css") %>" rel="stylesheet"
        type="text/css" />
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            var totalKpiChild = $("#<%=hfTotalDataKpiChild.ClientID %>").val();
            var KpiId = $("#<%=hfKpiId.ClientID %>").val();
            $("#tblKpiChild tr").remove();
            $("#tblKpiChild tr table").remove();
            if (totalKpiChild != "0") {

                var handlerUrl = '<%= ResolveUrl("~/ProcessRequest/MethodDetailHandler.ashx") %>' + "?method=GetByKPIChild&KpiId=" + KpiId;
                var html = "";
                var html2 = "";
                var counter = 1;
                $("#tblKpiChild").append("<tr><td style='width:30px;' align='center'><b>No</b></td><td align='center' style='width:500px;'><b>KPI</b></td><td align='center' style='width:200px;'><b>Periode</b></td><td align='center' style='width:200px;'><b>Attachment</b></td></tr>");
                $.ajax({
                    type: 'POST',
                    url: handlerUrl,
                    contentType: 'application/json',
                    dataType: 'json',
                    success: function (datas) {
                        $.each(datas, function (i, data) {

                            //$("#tblKpiChild").append("<tr><td>" + counter + ".</td><td>" + data.Description + "</td><td>Test</td>");
                            //alert(data.Description);
                            html = "<tr><td align='center'>" + counter + ".</td><td style='padding-left:10px;'>" + data.Description + "</td><td style='padding-left:10px;'>" + data.Periode + "</td>";

                            $("#tblKpiChild").append(html + "<td><table id='tbl" + data.ID + "'></table></td></tr>");
                            //alert("1");
                            var handlerUrlAttachment = '<%= ResolveUrl("~/ProcessRequest/MethodDetailHandler.ashx") %>' + "?method=GetKPIAttachmentByKpiId&KpiId=" + data.ID;
                            var handlerUrlDownload = '<%= ResolveUrl("~/ProcessRequest/Downloadhandler.ashx") %>';
                            html2 = "";
                            $.ajax({
                                type: 'POST',
                                url: handlerUrlAttachment,
                                contentType: 'application/json',
                                dataType: 'json',
                                success: function (datasAttachment) {
                                    $.each(datasAttachment, function (a, dataAttachment) {
                                        //alert(dataAttachment.ID);
                                        if (dataAttachment.ID != "") {
                                            html2 += "<tr><td><li>" + "<a href='" + handlerUrlDownload + "?KPIAttachmentID=" + dataAttachment.ID + "'>" + dataAttachment.DocumentFileName + "</a>" + "</li></tr></td>";
                                        }
                                        else {
                                            html2 = "";
                                        }

                                        // alert("2");
                                    });

                                    // $("#tblKpiChild").append(html + "<td><ul type='square'>" + html2 + "</ul></td></tr>");
                                    if (html2 != "") {
                                        $("#tbl" + data.ID).append(html2);
                                    }
                                },
                                error: function () {
                                    alert('Error load data kpi child attachemnt !');
                                }

                            });

                            //  $("#tblKpiChild").append(html + "<td><ul type='square'>" + html2 + "</ul></td></tr>");
                            //$("#tblKpiChild").append(html + "<td><table id='tbl" + data.ID + "'></table></td></tr>");

                            counter++;
                        });
                    },
                    error: function () {
                        alert('Error load data kpi child !');
                    }
                });

            }

        });
    </script>

    <script language="javascript" type="text/javascript">
        $(function () {
            $("#tabs").tabs();
        });
    </script>

    <script language="javascript" type="text/javascript">
        function removeDiv(id) {
            id.remove();
            return false;
        }

        $(document).ready(function () {

            var uploader = new plupload.Uploader({
                runtimes: 'html5,flash,silverlight',
                browse_button: 'pickfiles',
                container: 'container',
                max_file_size: '5mb',
                url: '<%= ResolveUrl("~/ajaxhandler/administration/catalog/Positionhandler.ashx") %>' + '?method=insert',
                flash_swf_url: '<%= ResolveUrl("~/scripts/plupload/Moxie.swf") %>',
                silverlight_xap_url: '<%= ResolveUrl("~/scripts/plupload/Moxie.xap") %>',
                multi_selection: false,
                filters: [
                 { title: "Pdf files", extensions: "pdf" },
                 { title: "Excel files", extensions: "xls,xlsx" },
                //{ title: "Text files", extensions: "txt" },
			    {title: "Image files", extensions: "jpeg,jpg,gif,png" },
                 { title: "Word files", extensions: "doc,docx" },
                 { title: "Zip files", extensions: "zip" },
                  { title: "Rar files", extensions: "rar" }
                //	{ title: "PowerPoint files", extensions: "ppt,pptx" }
		]
                //,
                //       resize: { width: 320, height: 240, quality: 90 }
            });

            uploader.bind('Init', function (up, params) {

                var msg = 'Untuk dapat melakukan proses unggah / upload dokumen, browser anda harus mendukung salah satu teknologi, HTML 5 / Flash / Silverlight';

                if (params.runtime == 'html5') {
                    msg = '';
                } else if (params.runtime == 'flash') {
                    msg = '';
                } else if (params.runtime == 'silverlight') {
                    msg = ''
                }

                if (msg != '') {
                    alert(msg);
                }

            });

            uploader.init();

            uploader.bind('FilesAdded', function (up, files) {

                if (up.files.length > 1) {
                    alert('Klik button simpan terlebih dahulu untuk tambah file upload !');
                    return false;
                }



                $.each(files, function (i, file) {
                    var id = file.id.toString();
                    $('#filelist').append('<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ')' + '</div>'); //+ '&nbsp;&nbsp;<a href="#" onclick="removeDiv(' + id + ')"><img src="../images/cross.png"/></a>'
                    //$('#filelist').append('<div>' + '<a><img src="../images/cross.png"/></a>' + '</div>');
                    $("#<%=hfFileNameAttachemnt.ClientID %>").val(file.name);

                });

                //&nbsp;&nbsp;


                up.refresh(); // Reposition Flash/Silverlight
            });

            uploader.bind('FileUploaded', function (up, file, info) {

                var err = JSON.parse(info.response);
                alert(err.Message);

            });

            uploader.bind('UploadComplete', function (up, file) {

                var KPIAssignID = $("#<%=hfKpiAssignId.ClientID %>").val();
                var KPIId = $("#<%=hfKpiId.ClientID %>").val();
                var KPIAssignDetailID = $("#<%=hfKpiAssignDetailId.ClientID %>").val();
                document.location = "../pages/InputAchievementPage.aspx?User=" + $("#txt_user").val() + "&KPI=" + KPIId + "&KPIAssign=" + KPIAssignID + "&KPIAssignDetail=" + KPIAssignDetailID;
                $.msgBox("Transaction Success", null, { title: "Pesan" });
                //document.reload();


            });

            uploader.bind('Error', function (up, err) {

                var errMsg = '';

                switch (err.code) {
                    case (-600):
                        errMsg = 'File tidak boleh lebih dari 5 Mb';
                        break;
                    case (-601):
                        errMsg = 'File harus berformat excel/word/pdf/gambar/zp/rar';
                        break;
                    default:
                        errMsg = err.code + ' - ' + err.message;
                        break;
                }

                //alert(errMsg);
                $.msgBox(errMsg, null, { title: "Pesan Error" });

                up.refresh(); // Reposition Flash/Silverlight
            });

            $("#<%=btn_save.ClientID%>").click(function () {
                var MethodDtlId = "";
                var Realization = "";
                var Score = "";
                var isLock = "";
                var isOneSelectionYearly = false;
                var isOneSelectionYearlyValue = 0;
                var isOneSelectionSemester1 = false;
                var isOneSelectionSemester2 = false;
                var isOneSelectionQ1 = false;
                var isOneSelectionQ2 = false;
                var isOneSelectionQ3 = false;
                var isOneSelectionQ4 = false;
                var isOneSelectionTriwulan1 = false;
                var isOneSelectionTriwulan2 = false;
                var isOneSelectionTriwulan3 = false;
                var isOneSelectionWeekly = false;
                $('#tableMethod tr').each(function () {

                    var row = $(this);
                    var idCheckBox = row.find('input[type="checkbox"]').attr('id');
                    if (idCheckBox == "yearly" || idCheckBox == "semester1" || idCheckBox == "semester2"
                        || idCheckBox == "Q1" || idCheckBox == "Q2" || idCheckBox == "Q3" || idCheckBox == "Q4" || idCheckBox == "weekly") {
                        isLock += "undefined|";
                        //idCheckBox = "";

                    }

                    if (idCheckBox == "yearly") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionYearly = true;
                        }

                    }

                    if (idCheckBox == "semester1") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionSemester1 = true;
                        }
                    }

                    if (idCheckBox == "semester2") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionSemester2 = true;
                        }
                    }

                    if (idCheckBox == "Q1") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionQ1 = true;
                        }
                    }

                    if (idCheckBox == "Q2") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionQ2 = true;
                            //alert("MASUK Q2");
                        }
                    }

                    if (idCheckBox == "Q3") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionQ3 = true;
                            //alert("MASUK Q3");
                        }
                    }

                    if (idCheckBox == "Q4") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionQ4 = true;
                        }
                    }


                    if (idCheckBox == "triwulan1") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionTriwulan1 = true;
                        }
                    }

                    if (idCheckBox == "triwulan2") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionTriwulan2 = true;
                            //alert("MASUK Q2");
                        }
                    }

                    if (idCheckBox == "triwulan1") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionTriwulan3 = true;
                            //alert("MASUK Q3");
                        }
                    }

                    if (idCheckBox == "weekly") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isOneSelectionWeekly = true;
                        }

                    }

                    if (idCheckBox != "yearly" && idCheckBox != "semester1" && idCheckBox != "semester2"
                        && idCheckBox != "Q1" && idCheckBox != "Q2" && idCheckBox != "Q3" && idCheckBox != "Q4" && idCheckBox != "weekly") {
                        if (row.find('input[type="checkbox"]').is(':checked')) {
                            isLock += "1|";
                        }
                        else {
                            isLock += "0|";
                        }
                    }

                    var idTextBox = row.find('input[type="text"]').attr('id');
                    var idHidden = row.find('input[type="hidden"]').attr('id');
                    if (idTextBox != "" && idTextBox != "undefined") {
                        MethodDtlId += idHidden + "|";

                        var value = row.find('input[type="text"]').val();
                        //alert(value);
                        var valueScore = $('[name=txtScore' + idCheckBox + ']').val();
                        var valueRealisasi = $('[name=txtRealisasi' + idCheckBox + ']').val();
                        //alert(datalevel);
                        Realization += valueRealisasi + "|";
                        Score += valueScore + "|";

                    }

                    //var idFile = row.find('input[type="file"]').attr('id');
                    //alert(idFile);
                });

                if (isOneSelectionYearly) {

                    var mySplitResult = Realization.split("|");
                    for (i = 1; i < mySplitResult.length - 1; i++) {

                        if (mySplitResult[i] != "")
                            isOneSelectionYearlyValue += 1;
                    }

                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                        return false;
                    }

                }

                if (isOneSelectionSemester1) {

                    var mySplitResult = Realization.split("|");
                    for (i = 1; i < mySplitResult.length - 1; i++) {

                        if (mySplitResult[i] == "undefined")
                            break;
                        if (mySplitResult[i] != "")
                            isOneSelectionYearlyValue += 1;
                    }

                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Semester 1 isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                        return false;
                    }
                }

                if (isOneSelectionSemester2) {
                    //var isOneSelectionSmt2Value = 0;
                    isOneSelectionYearlyValue = 0;
                    var valueSemester2 = "";
                    var mySplitResult = Realization.split("|");
                    for (i = 1; i < mySplitResult.length - 1; i++) {

                        if (mySplitResult[i] == "undefined")
                            valueSemester2 = mySplitResult[i];

                        if (valueSemester2 == "undefined") {
                            if (mySplitResult[i] != "" && mySplitResult[i] != "undefined") {
                                isOneSelectionYearlyValue += 1;
                            }
                        }

                    }
                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Semester 2 isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                        return false;
                    }
                }

                if (isOneSelectionQ1) {

                    var mySplitResult = Realization.split("|");
                    for (i = 1; i < mySplitResult.length - 1; i++) {

                        if (mySplitResult[i] == "undefined")
                            break;
                        if (mySplitResult[i] != "")
                            isOneSelectionYearlyValue += 1;
                    }

                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Q 1 isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                    }
                }

                if (isOneSelectionQ2) {
                    isOneSelectionYearlyValue = 0;
                    var mySplitResult = Realization.split("undefined");
                    var mySplitResult2 = mySplitResult[2].split("|");
                    for (j = 0; j < mySplitResult2.length; j++) {
                        if (mySplitResult2[j] != "" && mySplitResult2[j] != "undefined") {
                            isOneSelectionYearlyValue += 1;
                        }

                    }

                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Q 2 isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                        return false;
                    }

                }

                if (isOneSelectionQ3) {
                    isOneSelectionYearlyValue = 0;
                    var mySplitResult = Realization.split("undefined");
                    var mySplitResult2 = mySplitResult[3].split("|");
                    for (j = 0; j < mySplitResult2.length; j++) {
                        if (mySplitResult2[j] != "" && mySplitResult2[j] != "undefined") {
                            isOneSelectionYearlyValue += 1;
                        }

                    }

                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Q 3 isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                        return false;
                    }
                }

                if (isOneSelectionQ4) {
                    isOneSelectionYearlyValue = 0;
                    var mySplitResult = Realization.split("undefined");
                    var mySplitResult2 = mySplitResult[4].split("|");
                    for (j = 0; j < mySplitResult2.length; j++) {
                        if (mySplitResult2[j] != "" && mySplitResult2[j] != "undefined") {
                            isOneSelectionYearlyValue += 1;
                        }

                    }

                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Q 4 isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                        return false;
                    }
                }


                if (isOneSelectionTriwulan1) {

                    var mySplitResult = Realization.split("|");
                    for (i = 1; i < mySplitResult.length - 1; i++) {

                        if (mySplitResult[i] == "undefined")
                            break;
                        if (mySplitResult[i] != "")
                            isOneSelectionYearlyValue += 1;
                    }

                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Triwulan 1 isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                    }
                }

                if (isOneSelectionTriwulan2) {
                    isOneSelectionYearlyValue = 0;
                    var mySplitResult = Realization.split("undefined");
                    var mySplitResult2 = mySplitResult[2].split("|");
                    for (j = 0; j < mySplitResult2.length; j++) {
                        if (mySplitResult2[j] != "" && mySplitResult2[j] != "undefined") {
                            isOneSelectionYearlyValue += 1;
                        }

                    }

                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Triwulan 2 isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                        return false;
                    }

                }

                if (isOneSelectionTriwulan3) {
                    isOneSelectionYearlyValue = 0;
                    var mySplitResult = Realization.split("undefined");
                    var mySplitResult2 = mySplitResult[3].split("|");
                    for (j = 0; j < mySplitResult2.length; j++) {
                        if (mySplitResult2[j] != "" && mySplitResult2[j] != "undefined") {
                            isOneSelectionYearlyValue += 1;
                        }

                    }

                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Triwulan 3 isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                        return false;
                    }
                }


                if (isOneSelectionWeekly) {

                    var mySplitResult = Realization.split("|");
                    for (i = 1; i < mySplitResult.length - 1; i++) {

                        if (mySplitResult[i] != "")
                            isOneSelectionYearlyValue += 1;
                    }

                    if (isOneSelectionYearlyValue > 1) {
                        $.msgBox("Isi nilai tidak boleh lebih dari satu !", null, { title: "Pesan" });
                        return false;
                    }

                }


                var KPIAssignID = $("#<%=hfKpiAssignId.ClientID %>").val();
                var Year = $("#<%=txt_kpiyear.ClientID %>").val();
                var Status = $("#<%=ddl_statusbyuser.ClientID %> option:selected").val();
                if (Status == "0") {
                    $.msgBox("Pilih status KPI by user !", null, { title: "Pesan Error" });
                    return false;
                }


                var fileName = $("#<%=hfFileNameAttachemnt.ClientID %>").val();
                var KPIAssignID = $("#<%=hfKpiAssignId.ClientID %>").val();
                var KPIId = $("#<%=hfKpiId.ClientID %>").val();
                var KPIAssignDetailID = $("#<%=hfKpiAssignDetailId.ClientID %>").val();
                var Year = $("#<%=txt_kpiyear.ClientID %>").val();
                var Status = $("#<%=ddl_statusbyuser.ClientID %> option:selected").val();
                if (Status == "0") {
                    $.msgBox("Pilih status KPI by user !", null, { title: "Pesan Error" });
                    return false;
                }
                var handlerUrl = '<%= ResolveUrl("~/ProcessRequest/KPIAchievementHandler.ashx") %>';
                var DeleteAttachment = $("#<%=hfDeleteAttachmentID.ClientID %>").val();

                if (uploader.files.length > 0) // Insert with uploaded file.
                {
                    //alert("Ada");
                    uploader.settings.multipart_params = {
                        'MethodDtlId': encodeURIComponent(MethodDtlId),
                        'Realization': encodeURIComponent(Realization),
                        'KPIAssignID': encodeURIComponent(KPIAssignID),
                        'KPIAssignDetailID': encodeURIComponent(KPIAssignDetailID),
                        'KPIId': encodeURIComponent(KPIId),
                        'Year': encodeURIComponent(Year),
                        'isLock': encodeURIComponent(isLock),
                        'Score': encodeURIComponent(Score),
                        'Status': encodeURIComponent(Status),
                        'CurrUser': encodeURIComponent($("#txt_user").val()),
                        'FileName': encodeURIComponent(fileName),
                        'DeleteAttachment': encodeURIComponent(DeleteAttachment)
                    };

                    uploader.settings.url = handlerUrl; // +'?method=insert';
                    uploader.start();


                }
                else {

                    var param = "?";
                    param = param + "&MethodDtlId=" + MethodDtlId;
                    param = param + "&Realization=" + Realization;
                    param = param + "&KPIAssignID=" + KPIAssignID;
                    param = param + "&KPIAssignDetailID=" + KPIAssignDetailID;
                    param = param + "&KPIId=" + KPIId;
                    param = param + "&Year=" + Year;
                    param = param + "&isLock=" + isLock;
                    param = param + "&Score=" + Score;
                    param = param + "&Status=" + Status;
                    param = param + "&CurrUser=" + $("#txt_user").val();
                    param = param + "&DeleteAttachment="+DeleteAttachment;

                    $.ajax({ url: '../ProcessRequest/' + "KPIAchievementHandler.ashx" + param, type: "POST",
                        success: function (response) {
                            //alert(response);
                            $.msgBox(response, null, { title: "Pesan" });
                            if (response.indexOf('Success') > 0) {

                                document.location = "../Pages/AchievementPage.aspx";

                                //document.location = "../pages/InputAchievementPage.aspx?User=" + $("#txt_user").val() + "&KPI=" + KPIId + "&KPIAssign=" + KPIAssignID + "&KPIAssignDetail=" + KPIAssignDetailID;
                            }

                        },
                        error: function (xhr, ajaxOptions, thrownError) {
                            //alert(xhr.responseText);
                            $.msgBox(xhr.responseText, null, { title: "Pesan Error" });
                        }
                    });

                }

                //document.location = "../pages/InputAchievementPage.aspx?User=" + $("#txt_user").val() + "&KPI=" + KPIId + "&KPIAssign=" + KPIAssignID + "&KPIAssignDetail=" + KPIAssignDetailID;
                return false;

            });
        });
    </script>

    <script language="javascript" type="text/javascript">

        function removeAttachmen(id, IdAttachment) {

            $.msgBox.confirm("Benar attachment akan dihapus ?", function () {
                id.remove();
                var value = $("#<%=hfDeleteAttachmentID.ClientID%>").val();
                value = value + "|" + IdAttachment;
                $("#<%=hfDeleteAttachmentID.ClientID%>").val(value)
            }, false);


          
           
        }
        $(document).ready(function () {

            $("#<%=hfDeleteAttachmentID.ClientID%>").val("")

            var totalAttachment = $("#<%=hfTotalDataAttachment.ClientID %>").val();
            var KPIAssignID = $("#<%=hfKpiAssignId.ClientID %>").val();
            var KpiId = $("#<%=hfKpiId.ClientID %>").val();
            var KPIAssignDetailID = $("#<%=hfKpiAssignDetailId.ClientID %>").val();
            var html = "";
            var counter = "";// 1;


            var handlerUrlDownload = '<%= ResolveUrl("~/ProcessRequest/Downloadhandler.ashx") %>';

            if (totalAttachment != "0") {
                var handlerUrl = '<%= ResolveUrl("~/ProcessRequest/MethodDetailHandler.ashx") %>' + "?method=GetByKPIAttachment&KpiId=" + KpiId + "&KPIAssignID=" + KPIAssignID + "&KPIAssignDetailID=" + KPIAssignDetailID;

                $.ajax({
                    type: 'POST',
                    url: handlerUrl,
                    contentType: 'application/json',
                    dataType: 'json',
                    success: function (datas) {
                        $.each(datas, function (i, data) {
                            $("#tblAttachment").append("<tr id='trAttachment" + data.ID + "'><td>" + counter + "&nbsp;&nbsp;</td><td>" + "<a href='" + handlerUrlDownload + "?KPIAttachmentID=" + data.ID + "'>" + data.DocumentFileName + "</a>&nbsp;&nbsp;<a onclick='removeAttachmen(trAttachment" + data.ID + "," + data.ID + ")' href='#'>remove</a></td></tr>");
                            //counter++;
                        });
                    },
                    error: function () {
                        alert('Error load data attachment !');
                    }
                });
            }

        });
    </script>

    <script type="text/javascript">
    $(document).ready(function () {
        var KpiId = $("#<%=hfKpiId.ClientID %>").val();
        $("#tableMethod tr").remove();
        var html="";
        var handlerUrl ="";
        if(KpiId!="")
        {
                handlerUrl = '<%= ResolveUrl("~/ProcessRequest/MethodDetailHandler.ashx") %>'+ "?method=GetByKPIAchievment&KpiId=" + KpiId;
                var totalData = $("#<%=hfTotalDataAchievment.ClientID %>").val();
               
                if(totalData!="0")
                {
                  var KPIAssignID = $("#<%=hfKpiAssignId.ClientID %>").val();
                  handlerUrl = '<%= ResolveUrl("~/ProcessRequest/MethodDetailHandler.ashx") %>'+ "?method=GetByKPIAchievmentEdit&KPIAssignID=" + KPIAssignID;
                }


                var isYearly =false;
                var htmlYearly ="";
                var htmlSemester1="";
                var htmlSemester2="";
                var htmlQ1="";
                var htmlQ2="";
                var htmlQ3="";
                var htmlQ4="";
                var methodId="";
                var Realization="";
                 var Score="";
                 $.ajax({
                    type: 'POST',
                    url: handlerUrl,
                    contentType: 'application/json',
                    dataType: 'json',
                    success: function (datas) {
                        $.each(datas, function (i, data) {
                            methodId=data.MethodDetail.MethodID;
                            if (data.MethodDetail.MethodID == 1) {
                            
                                  if(isYearly==false)
                                  {
                                      if (data.isOneSelection == true) {
                                          htmlYearly = "<tr><td><input disabled='disabled' checked='checked' type='checkbox' id='yearly' />Only One Selection</td><td style='padding-left:30px;'>Realisasi</td><td style='padding-left:30px;'>Score</td><td style='padding-left:50px;'>Lock</td></tr>";//<td style='padding-left:50px;'>Attachment</td></tr>";
                                        }
                                        else {
                                            htmlYearly = "<tr><td><input disabled='disabled'  type='checkbox' id='yearly' />Only One Selection</td><td style='padding-left:30px;'>Realisasi</td><td style='padding-left:30px;'>Score</td><td style='padding-left:50px;'>Lock</td></tr>";//<td style='padding-left:50px;'>Attachment</td></tr>";
                                        }

                                        isYearly=true;
                                 }

                                 if(totalData!="0")
                                 {
                                   Realization = data.Realization;

                                   if (data.Score != "0")
                                    Score = data.Score;
                                else
                                    Score = "";
                                 }
                               
                               
                               if(data.isLocked)
                                 //htmlYearly  += "<tr><td>" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:30px;'><input type='text' disabled='disabled' value='"+Realization+"' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:50px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"'  disabled='disabled' checked='checked' /></td></tr>";
                                 htmlYearly  += "<tr><td><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:30px;'><input size='30' type='text' disabled='disabled' value='"+Realization+"' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:30px;'><input size='10' type='text' disabled='disabled' value='"+Score+"' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:50px;'><input disabled='disabled' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' checked='checked' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";//<td style='padding-left:50px;'><input type='file' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                               else
                                //htmlYearly  += "<tr><td>" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:30px;'><input size='30' type='text' value='"+Realization+"' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:30px;'><input size='10' type='text' value='"+Realization+"' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:50px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:50px;'><input type='file' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                htmlYearly  += "<tr><td><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:30px;'><input size='30' type='text' value='"+Realization+"' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:30px;'><input size='10' type='text' value='"+Score+"' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:50px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";//<td style='padding-left:50px;'><input type='file' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                               
                            }



                            if (data.MethodDetail.MethodID == 2) {

                                if (data.MethodDetail.MethodDtlName == "Jan" || data.MethodDetail.MethodDtlName == "Feb"
                                ||data.MethodDetail.MethodDtlName == "Mar" || data.MethodDetail.MethodDtlName == "Apr"
                                ||data.MethodDetail.MethodDtlName == "May" || data.MethodDetail.MethodDtlName == "Jun") {
                                    if(htmlSemester1=="")
                                    {
                                       if (data.isOneSelection == true) {
                                          htmlSemester1 = "<tr><td style='width:100px;'><input disabled='disabled' checked='checked' type='checkbox' id='semester1'/>Semester 1</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                        else {
                                            //htmlSemester1 = "<tr><td><input disabled='disabled'  type='checkbox' id='semester1'/>Semester 1<td style='padding-left:10px;'>Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                            htmlSemester1 = "<tr><td style='width:100px;'><input disabled='disabled'  type='checkbox' id='semester1'/>Semester 1</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                     }

                                     if(totalData!="0")
                                       {
                                            Realization = data.Realization;
                                            
                                             if (data.Score != "0")
                                                  Score = data.Score;
                                            else
                                                Score = "";
                                       }
                                    
                                    if(data.isLocked)
                                      //htmlSemester1 += "<tr><td>" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' disabled='disabled' checked='checked' /></td></tr>";
                                      htmlSemester1 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input disabled='disabled' checked='checked' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                    else
                                      htmlSemester1 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                }

                                
                                    if (data.MethodDetail.MethodDtlName == "Jul" || data.MethodDetail.MethodDtlName == "Aug"
                                ||data.MethodDetail.MethodDtlName == "Sep" || data.MethodDetail.MethodDtlName == "Oct"
                                ||data.MethodDetail.MethodDtlName == "Nov" || data.MethodDetail.MethodDtlName == "Dec") {


                                 if(htmlSemester2=="")
                                    {
                                       if (data.isOneSelection == true) {
                                         // htmlSemester2 = "<tr><td colspan='2' style='padding-top:10px;'><input disabled='disabled' checked='checked' type='checkbox' id='semester2' />Semester 2&nbsp;&nbsp;Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                         htmlSemester2 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled' checked='checked' type='checkbox' id='semester2'/>Semester 2</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                        else {
                                            //htmlSemester2 = "<tr><td colspan='2' style='padding-top:10px;'><input disabled='disabled'  type='checkbox' id='semester2' />Semester 2 &nbsp;&nbsp;Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                            htmlSemester2 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled'  type='checkbox' id='semester2'/>Semester 2</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                     }

                                        if(totalData!="0")
                                       {
                                            Realization = data.Realization;
                                              if (data.Score != "0")
                                                  Score = data.Score;
                                            else
                                                Score = "";
                                       }
                                           
                                       //htmlSemester2 += "<tr><td style='width:10px;'>" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+" '/></td></tr>";
                                    
                                    if(data.isLocked)
                                      //htmlSemester2 += "<tr><td style='width:5px;'>" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' disabled='disabled' checked='checked' /></td></tr>";
                                      htmlSemester2 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input disabled='disabled' checked='checked' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                    else
                                     //htmlSemester2 += "<tr><td style='width:5px;'>" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                     htmlSemester2 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                }
                            }

                            if (data.MethodDetail.MethodID == 3) {

                                if (data.MethodDetail.MethodDtlName == "Jan" || data.MethodDetail.MethodDtlName == "Feb"
                                ||data.MethodDetail.MethodDtlName == "Mar") {
                                    if(htmlQ1=="")
                                    {
                                      if (data.isOneSelection == true) {
                                            //htmlQ1 = "<tr><td colspan='2'><input disabled='disabled' checked='checked' type='checkbox' id='Q1' /> Q 1&nbsp;&nbsp; Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                            htmlQ1 = "<tr><td style='width:100px;'><input disabled='disabled' checked='checked' type='checkbox' id='Q1'/>Q 1</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";

                                        }
                                        else {
                                            //htmlQ1 = "<tr><td colspan='2'><input disabled='disabled'  type='checkbox' id='Q1' />Q 1&nbsp;&nbsp; Only One Selection</td></tr>";
                                            htmlQ1 = "<tr><td style='width:100px;'><input disabled='disabled'  type='checkbox' id='Q1'/>Q 1</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                    }

                                     if(totalData!="0")
                                       {
                                            Realization = data.Realization;
                                              if (data.Score != "0")
                                                  Score = data.Score;
                                            else
                                                Score = "";
                                       }

                                    //htmlQ1 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+" '/></td></tr>";
                                    
                                     if(data.isLocked)
                                     //htmlQ1 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input disabled='disabled' type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' disabled='disabled' checked='checked'/></td></tr>";
                                     htmlQ1 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input disabled='disabled' checked='checked' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                     else
                                     //htmlQ1 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"'/></td></tr>";
                                     htmlQ1 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                
                                }

                                if (data.MethodDetail.MethodDtlName == "Apr"
                                ||data.MethodDetail.MethodDtlName == "May" || data.MethodDetail.MethodDtlName == "Jun") {
                                   
                                   if(htmlQ2=="")
                                    {
                                      if (data.isOneSelection == true) {
                                            //htmlQ2 = "<tr><td style='padding-top:20px;' colspan='2'><input disabled='disabled' checked='checked' type='checkbox' id='Q2' /> Q 2&nbsp;&nbsp; Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                            htmlQ2 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled' checked='checked' type='checkbox' id='Q2'/>Q 2</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";

                                        }
                                        else {
                                            //htmlQ2 = "<tr><td style='padding-top:20px;' colspan='2'><input disabled='disabled'  type='checkbox' id='Q2' /> Q 2&nbsp;&nbsp; Only One Selection</td></tr>";
                                           htmlQ2 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled'  type='checkbox' id='Q2'/>Q 2</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                    }

                                     if(totalData!="0")
                                       {
                                            Realization = data.Realization;
                                              if (data.Score != "0")
                                                  Score = data.Score;
                                            else
                                                Score = "";
                                       }

                                    //htmlQ2 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+" '/></td></tr>";
                                    
                                    if(data.isLocked)
                                     //htmlQ2 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input disabled='disabled' type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' disabled='disabled' checked='checked'/></td></tr>";
                                     htmlQ2 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input disabled='disabled' checked='checked' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                     else
                                     //htmlQ2 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"'/></td></tr>";
                                     htmlQ2 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                }

                               
                                
                                    if (data.MethodDetail.MethodDtlName == "Jul" || data.MethodDetail.MethodDtlName == "Aug"
                                ||data.MethodDetail.MethodDtlName == "Sep") {
                                    
                                    if(htmlQ3=="")
                                    {
                                      if (data.isOneSelection == true) {
                                            //htmlQ3 = "<tr><td style='padding-top:20px;' colspan='2'><input disabled='disabled' checked='checked' type='checkbox' id='Q3' />Q 3&nbsp;&nbsp; Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                            htmlQ3 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled' checked='checked' type='checkbox' id='Q3'/>Q 3</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";

                                        }
                                        else {
                                            //htmlQ3 = "<tr><td style='padding-top:20px;' colspan='2'><input disabled='disabled'  type='checkbox' id='Q3' />Q 3&nbsp;&nbsp; Only One Selection</td></tr>";
                                            htmlQ3 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled'  type='checkbox' id='Q3'/>Q 3</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                    } 
                                    
                                     if(totalData!="0")
                                       {
                                            Realization = data.Realization;
                                              if (data.Score != "0")
                                                  Score = data.Score;
                                            else
                                                Score = "";
                                       }   

                                      //htmlQ3 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+" '/></td></tr>";
                                    if(data.isLocked)
                                     //htmlQ3 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input disabled='disabled' type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' disabled='disabled' checked='checked'/></td></tr>";
                                    htmlQ3 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input disabled='disabled' checked='checked' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                    else
                                     //htmlQ3 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"'/></td></tr>";
                                     htmlQ3 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                }

                                   if (data.MethodDetail.MethodDtlName == "Oct"
                                ||data.MethodDetail.MethodDtlName == "Nov" || data.MethodDetail.MethodDtlName == "Dec") {
                                        
                                  if(htmlQ4=="")
                                    {
                                      if (data.isOneSelection == true) {
                                           // htmlQ4 = "<tr><td style='padding-top:20px;' colspan='2'><input disabled='disabled' checked='checked' type='checkbox' id='Q4' />Q 4&nbsp;&nbsp; Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                           htmlQ4 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled' checked='checked' type='checkbox' id='Q4'/>Q 4</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";

                                        }
                                        else {
                                            //htmlQ4 = "<tr><td style='padding-top:20px;' colspan='2'><input disabled='disabled'  type='checkbox' id='Q4' /> Q 4&nbsp;&nbsp; Only One Selection</td></tr>";
                                           htmlQ4 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled'  type='checkbox' id='Q4'/>Q 4</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                    } 
                                        
                                         if(totalData!="0")
                                       {
                                            Realization = data.Realization;
                                              if (data.Score != "0")
                                                  Score = data.Score;
                                            else
                                                Score = "";
                                       }
                                        //htmlQ4 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+" '/></td></tr>";
                                    
                                    if(data.isLocked)
                                     //htmlQ4 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input disabled='disabled' type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' disabled='disabled' checked='checked'/></td></tr>";
                                     htmlQ4 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input disabled='disabled' checked='checked' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                     else
                                     //htmlQ4 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"'/></td></tr>";
                                     htmlQ4 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                }
                            }

                           
                            if (data.MethodDetail.MethodID == 4) {

                                if (data.MethodDetail.MethodDtlName == "Jan" || data.MethodDetail.MethodDtlName == "Feb"
                                ||data.MethodDetail.MethodDtlName == "Mar" ||data.MethodDetail.MethodDtlName == "Apr") {
                                    if(htmlQ1=="")
                                    {
                                      if (data.isOneSelection == true) {
                                            //htmlQ1 = "<tr><td colspan='2'><input disabled='disabled' checked='checked' type='checkbox' id='triwulan1' /> Triwulan 1&nbsp;&nbsp;Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                             htmlQ1 = "<tr><td style='width:100px;'><input disabled='disabled' checked='checked' type='checkbox' id='triwulan1'/>Triwulan 1</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";

                                        }
                                        else {
                                            //htmlQ1 = "<tr><td colspan='2'><input disabled='disabled'  type='checkbox' id='triwulan1' />Triwulan 1&nbsp;&nbsp; Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                            htmlQ1 = "<tr><td style='width:100px;'><input disabled='disabled'  type='checkbox' id='triwulan1'/>Triwulan 1</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                    }

                                     if(totalData!="0")
                                       {
                                            Realization = data.Realization;
                                              if (data.Score != "0")
                                                  Score = data.Score;
                                            else
                                                Score = "";
                                       }

                                    //htmlQ1 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+" '/></td></tr>";
                                    if(data.isLocked)
                                     //htmlQ1 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input disabled='disabled' type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' disabled='disabled' checked='checked'/></td></tr>";
                                      htmlQ1 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input disabled='disabled' checked='checked' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                     else
                                     //htmlQ1 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"'/></td></tr>";
                                     htmlQ1 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                }

                                if (data.MethodDetail.MethodDtlName == "May"
                                ||data.MethodDetail.MethodDtlName == "Jun" || data.MethodDetail.MethodDtlName == "Jul" || data.MethodDetail.MethodDtlName == "Aug") {
                                   
                                   if(htmlQ2=="")
                                    {
                                      if (data.isOneSelection == true) {
                                            //htmlQ2 = "<tr><td style='padding-top:10px;' colspan='2'><input disabled='disabled' checked='checked' type='checkbox' id='triwulan2' />Triwulan 2&nbsp;&nbsp; Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                            htmlQ2 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled' checked='checked' type='checkbox' id='triwulan2'/>Triwulan 2</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";

                                        }
                                        else {
                                            //htmlQ2 = "<tr><td style='padding-top:10px;' colspan='2'><input disabled='disabled'  type='checkbox' id='triwulan2' />Triwulan 2&nbsp;&nbsp; Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                            htmlQ2 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled'  type='checkbox' id='triwulan2'/>Triwulan 2</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                    }

                                     if(totalData!="0")
                                       {
                                            Realization = data.Realization;
                                             Score = data.Score;
                                       }

                                    //htmlQ2 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+" '/></td></tr>";
                                     if(data.isLocked)
                                     //htmlQ2 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input disabled='disabled' type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' disabled='disabled' checked='checked'/></td></tr>";
                                     htmlQ2 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input disabled='disabled' checked='checked' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                     else
                                     //htmlQ2 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"'/></td></tr>";
                                     htmlQ2 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                }

                                
                                    if (data.MethodDetail.MethodDtlName == "Sep" || data.MethodDetail.MethodDtlName == "Oct"
                                ||data.MethodDetail.MethodDtlName == "Nov" ||data.MethodDetail.MethodDtlName == "Dec") {
                                    
                                    if(htmlQ3=="")
                                    {
                                      if (data.isOneSelection == true) {
                                            //htmlQ3 = "<tr><td style='padding-top:10px;' colspan='2'><input disabled='disabled' checked='checked' type='checkbox' id='triwulan3' />Triwulan 3&nbsp;&nbsp; Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                            htmlQ3 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled' checked='checked' type='checkbox' id='triwulan3'/>Triwulan 3</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";

                                        }
                                        else {
                                            //htmlQ3 = "<tr><td style='padding-top:10px;' colspan='2'><input disabled='disabled'  type='checkbox' id='triwulan3' />Triwulan 3&nbsp;&nbsp; Only One Selection</td><td style='padding-left:30px;'>Lock</td></tr>";
                                            htmlQ3 = "<tr><td style='width:100px;padding-top:20px;'><input disabled='disabled'  type='checkbox' id='triwulan3'/>Triwulan 3</td><td style='padding-left:10px'>Realisasi</td><td style='padding-left:10px'>Score</td><td style='padding-left:30px;'>Lock</td></tr>";
                                        }
                                    } 
                                    
                                     if(totalData!="0")
                                       {
                                            Realization = data.Realization;
                                             if (data.Score != "0")
                                                  Score = data.Score;
                                            else
                                                Score = "";
                                       }   

                                      //htmlQ3 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+" '/></td></tr>";
                                     if(data.isLocked)
                                     //htmlQ3 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input disabled='disabled' type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' disabled='disabled' checked='checked'/></td></tr>";
                                     htmlQ3 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input disabled='disabled' size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input disabled='disabled' type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input disabled='disabled' checked='checked' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                     else
                                     //htmlQ3 += "<tr><td>" + data.MethodDetail.MethodDtlName + "&nbsp;&nbsp;</td><td><input type='text' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"'/></td></tr>";
                                     htmlQ3 += "<tr><td style='width:100px;'><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:10px;'><input size='30' type='text' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' value='"+Realization+"' /></td><td style='padding-left:10px;'><input type='text' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' value='"+Score+"' size='10' /></td><td style='padding-left:30px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                }

                                  
                            }

                            if (data.MethodDetail.MethodID == 5) {

                                   if(isYearly==false)
                                  {
                                      if (data.isOneSelection == true) {
                                          htmlYearly = "<tr><td><input disabled='disabled' checked='checked' type='checkbox' id='weekly' />Only One Selection</td><td style='padding-left:30px;'>Realisasi</td><td style='padding-left:30px;'>Score</td><td style='padding-left:50px;'>Lock</td></tr>";//<td style='padding-left:50px;'>Attachment</td></tr>";
                                        }
                                        else {
                                            htmlYearly = "<tr><td><input disabled='disabled'  type='checkbox' id='weekly' />Only One Selection</td><td style='padding-left:30px;'>Realisasi</td><td style='padding-left:30px;'>Score</td><td style='padding-left:50px;'>Lock</td></tr>";//<td style='padding-left:50px;'>Attachment</td></tr>";
                                        }

                                        isYearly=true;
                                 }

                                 if(totalData!="0")
                                 {
                                   Realization = data.Realization;
                                   if (data.Score != "0")
                                        Score = data.Score;
                                   else
                                       Score = "";
                                 }
                               
                               
                               if(data.isLocked)
                                 //htmlYearly  += "<tr><td>" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:30px;'><input type='text' disabled='disabled' value='"+Realization+"' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:50px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"'  disabled='disabled' checked='checked' /></td></tr>";
                                 htmlYearly  += "<tr><td><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:30px;'><input size='30' type='text' disabled='disabled' value='"+Realization+"' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:30px;'><input size='10' type='text' disabled='disabled' value='"+Score+"' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:50px;'><input disabled='disabled' type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' checked='checked' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";//<td style='padding-left:50px;'><input type='file' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                               else
                                //htmlYearly  += "<tr><td>" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:30px;'><input size='30' type='text' value='"+Realization+"' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:30px;'><input size='10' type='text' value='"+Realization+"' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:50px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:50px;'><input type='file' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                                htmlYearly  += "<tr><td><input type='hidden' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' />" + data.MethodDetail.MethodDtlName + "</td><td style='padding-left:30px;'><input size='30' type='text' value='"+Realization+"' id='txtRealisasi"+data.MethodDetail.MethodDetailID+"' name='txtRealisasi"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:30px;'><input size='10' type='text' value='"+Score+"' id='txtScore"+data.MethodDetail.MethodDetailID+"' name='txtScore"+data.MethodDetail.MethodDetailID+"' /></td><td style='padding-left:50px;'><input type='checkbox' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";//<td style='padding-left:50px;'><input type='file' id='"+data.MethodDetail.MethodDetailID+"' name='"+data.MethodDetail.MethodDetailID+"' /></td></tr>";
                            }

                         });

                          //alert(methodId);

                         if(methodId=="1")
                         {
                           $("#tableMethod").append(htmlYearly);
                         }

                         if(methodId=="2")
                         {
                            //$("#tableMethod").append("<tr><td>Semester 1</td><td><input disabled='disabled' type='checkbox' id='semester1' /> Only One Selection</td></tr>");
                            $("#tableMethod").append(htmlSemester1);
                            //$("#tableMethod").append("<tr><td>Semester 2</td><td style='padding-top:15px;'><input disabled='disabled' type='checkbox' id='semester2' /> Only One Selection</td></tr>");
                            $("#tableMethod").append(htmlSemester2);
                         }

                         if(methodId=="3")
                         {
                            //$("#tableMethod").append("<tr><td>Q 1</td><td><input disabled='disabled' type='checkbox' id='Q1' /> Only One Selection</td></tr>");
                            $("#tableMethod").append(htmlQ1);
                            //$("#tableMethod").append("<tr><td>Q 2</td><td style='padding-top:15px;'><input disabled='disabled' type='checkbox' id='Q1' /> Only One Selection</td></tr>");
                            $("#tableMethod").append(htmlQ2);
                            //$("#tableMethod").append("<tr><td>Q 3</td><td style='padding-top:15px;'><input disabled='disabled' type='checkbox' id='Q3' /> Only One Selection</td></tr>");
                            $("#tableMethod").append(htmlQ3);
                            //$("#tableMethod").append("<tr><td>Q 4</td><td style='padding-top:15px;'><input disabled='disabled' type='checkbox' id='Q4' /> Only One Selection</td></tr>");
                            $("#tableMethod").append(htmlQ4);
                         }

                          if(methodId=="4")
                         {
                            //$("#tableMethod").append("<tr><td>Q 1</td><td><input disabled='disabled' type='checkbox' id='Q1' /> Only One Selection</td></tr>");
                            $("#tableMethod").append(htmlQ1);
                            //$("#tableMethod").append("<tr><td>Q 2</td><td style='padding-top:15px;'><input disabled='disabled' type='checkbox' id='Q1' /> Only One Selection</td></tr>");
                            $("#tableMethod").append(htmlQ2);
                            //$("#tableMethod").append("<tr><td>Q 3</td><td style='padding-top:15px;'><input disabled='disabled' type='checkbox' id='Q3' /> Only One Selection</td></tr>");
                            $("#tableMethod").append(htmlQ3);
                            //$("#tableMethod").append("<tr><td>Q 4</td><td style='padding-top:15px;'><input disabled='disabled' type='checkbox' id='Q4' /> Only One Selection</td></tr>");
                           
                         }

                          if(methodId=="5")
                         {
                           $("#tableMethod").append(htmlYearly);
                         }

                    },
                    error: function () {
                        alert('Error load method detail !');
                    }
                });

          
        }
        

        $("#btn_back").click(function () {
            document.location = "../Pages/AchievementPage.aspx?User=" + $("#txt_user").val();
            return false;
        });
    });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <div class="customPageTitle">
            KPI Information</div>
        <br />
        <div class="customPageContent">
            <table width="100%">
                <tr>
                    <td width="50%">
                        <table>
                            <tr>
                                <td width="140px" valign="middle">
                                    Description
                                </td>
                                <td class="Separator">
                                    :
                                </td>
                                <td>
                                    <asp:TextBox TextMode="MultiLine" Width="400" ID="txt_kpidescription" runat="server"
                                        ReadOnly="true" Rows="2"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="140px">
                                    Group
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_kpigroup" Width="400" runat="server" ReadOnly="true" class="longText"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="140px">
                                    Category
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_kpicategory" Width="400" runat="server" ReadOnly="true" class="longText"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="140px">
                                    Type
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_kpitype" Width="400" runat="server" ReadOnly="true" class="longText"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="140px">
                                    Sub Type
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_kpisubtype" Width="400" runat="server" ReadOnly="true" class="longText"></asp:TextBox>
                                </td>
                            </tr>
                            <tr runat="server" visible="false">
                                <td width="140px">
                                    Method
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txtMethod" runat="server" ReadOnly="true"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="140px">
                                    Status By Verificator
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:Label ID="lblVerificator" runat="server" Text=""></asp:Label>
                                    <%--<asp:TextBox ID="txt_statusbyuser" runat="server" Enabled="false"></asp:TextBox>--%>
                                </td>
                            </tr>
                            <tr>
                                <td width="140px">
                                    Status By User
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddl_statusbyuser" runat="server" Enabled="true">
                                    </asp:DropDownList>
                                    <%--<asp:TextBox ID="txt_statusbyuser" runat="server" Enabled="false"></asp:TextBox>--%>
                                </td>
                            </tr>
                            
                        </table>
                    </td>
                    <td width="50%">
                        <table>
                            <tr>
                                <td style="padding-left:50px;">
                                    Polarization
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_polarization" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr >
                                <td width="100px" style="padding-left:50px;">
                                    Year
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_kpiyear" runat="server" ReadOnly="true"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td  style="padding-left:50px;">
                                    Periode
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_kpiperiode" runat="server" ReadOnly="true"></asp:TextBox>
                                </td>
                            </tr>
                            <tr runat="server" visible="false">
                                <td >
                                    Unit of Measure
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_kpiuom" runat="server" ReadOnly="true" class="longText"></asp:TextBox><input
                                        type="hidden" runat="server" id="txt_uomformat" />
                                </td>
                            </tr>
                            <tr runat="server" visible="false">
                                <td>
                                    UoM Max
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_kpiuommax" runat="server" ReadOnly="true" class="longText"></asp:TextBox>
                                </td>
                            </tr>
                            <tr runat="server" visible="false">
                                <td>
                                    UoM Min
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_kpiuommin" runat="server" ReadOnly="true" class="longText"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding-left:50px;">
                                    Weight
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_weight" runat="server" ReadOnly="true"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding-left:50px;">
                                    is Active
                                </td>
                                <td>
                                    :
                                </td>
                                <td>
                                    <asp:CheckBox ID="chk_active" runat="server" Enabled="false" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <br />
    <div id="tabs">
        <ul>
            <li><a href="#tabs-1">METHOD KPI</a></li>
            <li><a href="#tabs-2">KPI CHILD</a></li>
        </ul>
        <div id="tabs-1">
            <%-- <div style="overflow: auto; height: 300px;">--%>
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <table id="tableMethod" cellpadding="0" cellspacing="0">
                        </table>
                    </td>
                    <td style="padding-left: 50px;">
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td valign="top">
                                    Attachment
                                </td>
                                <td valign="top">
                                    :
                                </td>
                                <td style="padding-left: 30px;">
                                    <div id="container">
                                        <a id="pickfiles" href="#"><span>Add Files</span> </a>
                                        <br />
                                        <div id="filelist" style="width: 300px;">
                                        </div>
                                        <ul class="uploads">
                                            <!-- Will be populated dynamically with LI/IMG tags. -->
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <table id="tblAttachment" cellpadding="0" cellspacing="0">
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <br />
            <button id="btn_save" class="ui-button ui-corner-all ui-button ui-state-default ui-button-text-icon-primary"
                runat="server" name="btnSave">
                <span class="ui-button-icon-primary ui-icon ui-icon-check"></span>
                <label class="ui-button-text">
                    Save</label>
            </button>
            <button id="btn_back" class="ui-button ui-corner-all ui-button ui-state-default ui-button-text-icon-primary">
                <span class="ui-button-icon-primary ui-icon ui-icon-arrowthick-1-w"></span>
                <label class="ui-button-text">
                    Back</label>
            </button>
            <asp:HiddenField ID="hfKpiId" runat="server" />
            <asp:HiddenField ID="hfKpiAssignId" runat="server" />
            <asp:HiddenField ID="hfKpiAssignDetailId" runat="server" />
            <asp:HiddenField ID="hfTotalDataAchievment" Value="0" runat="server" />
            <asp:HiddenField ID="hfTotalDataAttachment" Value="0" runat="server" />
            <asp:HiddenField ID="hfTotalDataKpiChild" Value="0" runat="server" />
            <asp:HiddenField ID="hfFileNameAttachemnt" Value="0" runat="server" />
            <asp:HiddenField ID="hfDeleteAttachmentID" runat="server" />
        </div>
        <div id="tabs-2">
            <table id="tblKpiChild" border="2" cellpadding="0" cellspacing="0">
            </table>
        </div>
    </div>
    <%-- </form>--%>
</asp:Content>
